import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/login",
    name: "login",
    component: () => import("../views/login/Login")
  },
  {
    path: "/",
    name: "home",
    component: () => import("../views/home/Home"),
    meta: { keepAlive: true, transition: "fade" },
    children: [
      {
        path: "",
        name: "org",
        component: () => import("../views/org/Org")
      },
      {
        path: "user",
        name: "user",
        component: () => import("../views/user/User")
      },
      {
        path: "role_index",
        name: "role_index",
        component: () => import("../views/role/Index"),
        meta: {keepAlive: true},
        children: [
          {
            path: "role",
            name: "role",
            component: () => import("../views/role/Role")
          },
          {
            path: "perm",
            name: "perm",
            component: () => import("../views/role/Perm")
          }
        ]
      },
      {
        path: "dict",
        name: "dict",
        component: () => import("../views/dict/Dict")
      },
      {
        path: "appclient",
        name: "appclient",
        component: () => import("../views/appclient/AppClient")
      },
      {
        path: "scheduler",
        name: "scheduler",
        component: () => import("../views/scheduler/Index"),
        meta: {keepAlive: true},
        children: [
          {
            path: "record",
            name: "record",
            component: () => import("../views/scheduler/Record")
          },
          {
            path: "job",
            name: "job",
            component: () => import("../views/scheduler/Job")
          },
          {
            path: "executor",
            name: "executor",
            component: () => import("../views/scheduler/Executor")
          }
        ]
      }
    ]
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
